<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
    <style>
        #app {
            width: 600px;
            margin: 40px auto;
        }

        button {
            margin-top: 15px;
        }
    </style>
</head>

<body>
    <div id="app">
        <h2>信息统计</h2>
        <form>
            <label>
                性别：
                <my-radio name="gender" value="0">男</my-radio>
                <my-radio name="gender" value="1">女</my-radio>
            </label>
            <div>
                <button>提交</button>
            </div>
        </form>
    </div>

    <script type="text/x-template" id="my-radio">
            <label>
                <input type="radio" :name="name" :value="value">
                <slot></slot>
            </label>
        </script>
    
    <script>

        Vue.component('my-radio', {
            template: '#my-radio',
            props: ['name', 'value']
        })

        let app = new Vue({
            el: "#app"
        })
    </script>
</body>

</html>